package models

import "gorm.io/datatypes"

type ForeList struct {
	BaseModel
	Code   string         `json:"code" gorm:"column:code"`
	Name   string         `json:"name" gorm:"column:name"`
	Status string         `json:"status" gorm:"column:status"`
	Data   datatypes.JSON `json:"data" gorm:"column:data"`
	//	拥有多个ForeDetail
	ForeDetail  []ForeDetail `gorm:"foreignKey:ForeListId;references:Id" json:"foreDetail"`
	IsSendEmail string       `json:"isSendEmail" gorm:"column:isSendEmail"`
	TargetEmail string       `json:"targetEmail" gorm:"column:targetEmail"`
	FormatEmail string       `json:"formatEmail" gorm:"column:formatEmail"`
	//	Fax
	IsSendFax string `json:"isSendFax" gorm:"column:isSendFax"`
	TargetFax string `json:"targetFax" gorm:"column:targetFax"`
	FormatFax string `json:"formatFax" gorm:"column:formatFax"`
	//ftp
	IsSendFtp string `json:"isSendFtp" gorm:"column:isSendFtp"`
	TargetFtp string `json:"targetFtp" gorm:"column:targetFtp"`
	FormatFtp string `json:"formatFtp" gorm:"column:formatFtp"`

	IsSend     string      `json:"isSend" gorm:"-"`
	SendTime   string      `json:"sendTime" gorm:"-"`
	EmailSends []EmailSend `gorm:"many2many:fore_email_send;" json:"emailSends"`
	FaxSends   []FaxSend   `gorm:"many2many:fore_fax_send;" json:"faxSends"`
	FtpSends   []FtpSend   `gorm:"many2many:fore_ftp_send;" json:"ftpSends"`
}

type ForeDetail struct {
	BaseModel
	Data       string `json:"data" gorm:"column:data"`
	State      string `json:"state" gorm:"column:state"`
	Time       string `json:"time" gorm:"column:time"`
	FileName   string `json:"fileName" gorm:"column:fileName"`
	ForeListId uint   `json:"foreListId" gorm:"column:foreListId;size:191"`
}

type Forecast struct {
	//WindWaveTemp interface{} `json:"windWaveTemp"`
	//Surge        interface{} `json:"surge"`
	//BhCySurge    interface{} `json:"bhCySurge"`
	//BhHySurge    interface{} `json:"bhHySurge"`
	Reports []struct {
		Title string `json:"title"`
		Rows  int    `json:"rows"`
		Cols  int    `json:"cols"`
		Data  [][]struct {
			Value string `json:"value"`
			Row   int    `json:"row"`
			Col   int    `json:"col"`
			//Cate      string `json:"cate"`
			//Bold bool `json:"bold"`
			//Overview  bool   `json:"overview"`
			//White bool `json:"white"`
			Hide bool `json:"hide"`
			Edit bool `json:"edit"`
			//Auth      bool   `json:"auth"`
			//RelateRow int    `json:"relateRow"`
			//RelateCol int    `json:"relateCol"`
		} `json:"dataVm"`
		MergeCell [][]int `json:"mergeCell"`
		//Overview         interface{} `json:"overview"`
		//TextBox          interface{} `json:"textBox"`
		//FixedRowCount    int         `json:"fixedRowCount"`
		//MergeRowCount    int         `json:"mergeRowCount"`
		//FrontLineIndices interface{} `json:"frontLineIndices"`
		//FrontColIndices  interface{} `json:"frontColIndices"`
	} `json:"reports"`
	//Overview interface{} `json:"overview"`
	//Number   interface{} `json:"number"`
	//FillInfo [][]struct {
	//	Value   string `json:"value"`
	//	Edit    bool   `json:"edit"`
	//	Auth    bool   `json:"auth"`
	//	Select  bool   `json:"select"`
	//	Options []struct {
	//		Name  string `json:"name"`
	//		Phone string `json:"phone"`
	//	} `json:"options"`
	//} `json:"fillInfo"`
	//OtherFields interface{} `json:"otherFields"`
	ContentArr interface{} `json:"contentArr"`
}

//三种txt的结构体

type Liangmi struct {
	BaseModel
	Date string `json:"date" gorm:"column:date;unique"`
	Time string `json:"time" gorm:"column:time"`
	Data string `json:"data" gorm:"column:data"`
}

type Liangmi8 struct {
	BaseModel
	Date string `json:"date" gorm:"column:date;unique"`
	Time string `json:"time" gorm:"column:time"`
	Data string `json:"data" gorm:"column:data"`
}

type Tide struct {
	Id              int    `json:"id" gorm:"column:id"`
	Date            string `json:"date" gorm:"column:date;unique"`
	HighTideOneTime string `json:"highTideOneTime" gorm:"column:highTideOneTime"`
	HighTideOneData string `json:"highTideOneData" gorm:"column:highTideOneData"`
	HighTideTwoTime string `json:"highTideTwoTime" gorm:"column:highTideTwoTime"`
	HighTideTwoData string `json:"highTideTwoData" gorm:"column:highTideTwoData"`
	LowTideOneTime  string `json:"lowTideOneTime" gorm:"column:lowTideOneTime"`
	LowTideOneData  string `json:"lowTideOneData" gorm:"column:lowTideOneData"`
	LowTideTwoTime  string `json:"lowTideTwoTime" gorm:"column:lowTideTwoTime"`
	LowTideTwoData  string `json:"lowTideTwoData" gorm:"column:lowTideTwoData"`
}

type AlarmDetail struct {
	BaseModel
	State      string   `json:"state" gorm:"column:state"`
	Type       string   `json:"type" gorm:"column:type"`
	PubType    string   `json:"pubType" gorm:"column:pubType"`
	Level      string   `json:"level" gorm:"column:level"`
	Time       string   `json:"time" gorm:"column:time"`
	FileName   string   `json:"fileName" gorm:"column:fileName"`
	Data       string   `json:"data" gorm:"column:data"`
	Data1      string   `json:"data1" gorm:"column:data1"`
	SendTime   string   `json:"sendTime" gorm:"column:sendTime"`
	Subject    string   `json:"subject" gorm:"column:subject"`
	TwcSub     []TwcSub `gorm:"foreignKey:AlarmDetailId;references:Id" json:"twcSub"`
	Bh         string   `json:"bh" gorm:"column:bh;size:255;uniqueIndex:idx_bh_region"`
	Region     string   `json:"region" gorm:"column:region;size:255;uniqueIndex:idx_bh_region"`
	FormatTime string   `json:"formatTime" gorm:"-"`
	Message    string   `json:"message" gorm:"-"`
}

type Rbr struct {
	Time  string `json:"time" gorm:"primary_key;column:time"`
	Depth string `json:"depth" gorm:"column:depth"`
}

type RbrCut struct {
	BaseModel
	Time    string `json:"time" gorm:"column:time"`
	Depth   string `json:"depth" gorm:"column:depth"`
	IsTop   string `json:"isTop" gorm:"column:isTop"`
	Station string `json:"station" gorm:"column:station"`
}

type Twc struct {
	Id   int    `json:"id" gorm:"column:id"`
	Date string `json:"date" gorm:"column:date"`
	Time string `json:"time" gorm:"column:time"`
	Tide string `json:"tide" gorm:"column:tide"`
}

type TwcTide struct {
	Id        int    `json:"id" gorm:"column:id"`
	Date      string `json:"date" gorm:"column:date;size:255;uniqueIndex:idx_date_station"`
	Station   string `json:"station" gorm:"column:station;size:255;uniqueIndex:idx_date_station"`
	TimeHigh1 string `json:"timeHigh1" gorm:"column:timeHigh1"`
	TideHigh1 string `json:"tideHigh1" gorm:"column:tideHigh1"`
	TimeHigh2 string `json:"timeHigh2" gorm:"column:timeHigh2"`
	TideHigh2 string `json:"tideHigh2" gorm:"column:tideHigh2"`
	TimeLow1  string `json:"timeLow1" gorm:"column:timeLow1"`
	TideLow1  string `json:"tideLow1" gorm:"column:tideLow1"`
	TimeLow2  string `json:"timeLow2" gorm:"column:timeLow2"`
	TideLow2  string `json:"tideLow2" gorm:"column:tideLow2"`
}

type Settting struct {
	ID     int `gorm:"primary_key" json:"id"`
	MaxAge int `json:"maxAge" gorm:"column:maxAge"`
}

type Fb struct {
	Time    string `json:"time" gorm:"column:time;size:255;uniqueIndex:idx_time_station"`
	Hs      string `json:"hs" gorm:"column:hs"`
	Tp      string `json:"tp" gorm:"column:tp"`
	Dir     string `json:"dir" gorm:"column:dir"`
	Station string `json:"station" gorm:"column:station;size:255;uniqueIndex:idx_time_station"`
}

type FbSa struct {
	Time string `json:"time" gorm:"column:time;primary_key"`
	Hs   string `json:"hs" gorm:"column:hs"`
	Tp   string `json:"tp" gorm:"column:tp"`
	Dir  string `json:"dir" gorm:"column:dir"`
}

type SendLog struct {
	Id         int    `gorm:"primary_key" json:"id"`
	Type       string `json:"type" gorm:"column:type"`
	FileName   string `json:"fileName" gorm:"column:fileName"`
	SendTime   string `json:"sendTime" gorm:"column:sendTime"`
	Operator   string `json:"operator" gorm:"column:operator"`
	State      string `json:"state" gorm:"column:state"`
	Target     string `json:"target" gorm:"column:target"`
	Time       string `json:"time" gorm:"column:time"`
	ForeListId int    `json:"foreListId" gorm:"column:foreListId"`
	ForeName   string `json:"foreName" gorm:"column:foreName"`
	AlarmId    int    `json:"alarmId" gorm:"-"`
}

type FileList struct {
	Id         int    `gorm:"primary_key" json:"id"`
	FileName   string `json:"fileName" gorm:"column:fileName"`
	CreateTime string `json:"createTime" gorm:"column:createTime"`
	State      string `json:"state" gorm:"column:state"`
}

type T1 struct {
	Time  string `json:"time" gorm:"primary_key;column:time"`
	Depth string `json:"depth" gorm:"column:depth"`
	IsTop string `json:"isTop" gorm:"column:isTop"`
}

type T2 struct {
	Time  string `json:"time" gorm:"primary_key;column:time"`
	Depth string `json:"depth" gorm:"column:depth"`
	IsTop string `json:"isTop" gorm:"column:isTop"`
}

type MailConfig struct {
	BaseModel
	Place    string `json:"place" gorm:"column:place"`
	Host     string `json:"host" gorm:"column:host"`
	Port     int    `json:"port" gorm:"column:port"`
	Username string `json:"username" gorm:"column:username"`
	Password string `json:"password" gorm:"column:password"`
}

type Test struct {
	BaseModel
	Num     int    `json:"num" gorm:"column:num"`
	Str     string `json:"str" gorm:"column:str"`
	StrVar  string `json:"strVar" gorm:"column:strVar;size:256"`
	StrVar1 string `json:"strVar1" gorm:"column:strVar1;type:varchar(256)"`
	JsonArr []byte `json:"jsonArr" gorm:"column:jsonArr"`
}

type TwcSub struct {
	BaseModel
	Date          string `json:"date" gorm:"column:date"`
	Time          string `json:"time" gorm:"column:time"`
	Tide          string `json:"tide" gorm:"column:tide"`
	Code          string `json:"code" gorm:"column:code"`
	Station       string `json:"station" gorm:"column:station"`
	Lan           string `json:"lan" gorm:"column:lan"`
	Huang         string `json:"huang" gorm:"column:huang"`
	Cheng         string `json:"cheng" gorm:"column:cheng"`
	Hong          string `json:"hong" gorm:"column:hong"`
	Level         string `json:"level" gorm:"column:level"`
	AlarmDetailId uint   `json:"alarmDetailId" gorm:"column:alarmDetailId"`
}

//type Temp struct {
//	ID   int `json:"id"`
//	Data []struct {
//		Time  string `json:"time"`
//		Value string `json:"value"`
//	} `json:"data"`
//}

type AlarmType struct {
	BaseModel
	Name    string `json:"name" gorm:"column:name"`
	Code    string `json:"code" gorm:"column:code"`
	Target  string `json:"target" gorm:"column:target"`
	Target1 string `json:"target1" gorm:"column:target1"`
}

type One struct {
	BaseModel
	Data datatypes.JSON `json:"data" gorm:"column:data"`
}

type ForeDetailJson struct {
	BaseModel
	Data       datatypes.JSON `json:"data" gorm:"column:data"`
	State      string         `json:"state" gorm:"column:state"`
	Time       string         `json:"time" gorm:"column:time;size:255;uniqueIndex:idx_time_foreListId"`
	FileName   string         `json:"fileName" gorm:"column:fileName"`
	ForeListId uint           `json:"foreListId" gorm:"column:foreListId;size:191;uniqueIndex:idx_time_foreListId"`
}

type Hdrc struct {
	BaseModel
	TimeRc  string `json:"timeRc" gorm:"column:timeRc"`
	TimeRl  string `json:"timeRl" gorm:"column:timeRl"`
	Date    string `json:"date" gorm:"column:date;size:255;uniqueIndex:idx_date_station"`
	Station string `json:"station" gorm:"column:station;size:255;uniqueIndex:idx_date_station"`
}

type Condition struct {
	BaseModel
	//	Date和Time和Station是联合主键
	Date    string `json:"date" gorm:"column:date;size:255;uniqueIndex:idx_date_time_station"`
	Time    string `json:"time" gorm:"column:time;size:255;uniqueIndex:idx_date_time_station"`
	Station string `json:"station" gorm:"column:station;size:255;uniqueIndex:idx_date_time_station"`
	//	均风风速，均风风向，大风风速，大风风向，最大波高，最大波周期，有效波高，有效波周期
	WindSpeedAvg  string `json:"windSpeedAvg" gorm:"column:windSpeedAvg"`
	WindAngleAvg  string `json:"windAngleAvg" gorm:"column:windAngleAvg"`
	WindSpeedMax  string `json:"windSpeedMax" gorm:"column:windSpeedMax"`
	WindAngleMax  string `json:"windAngleMax" gorm:"column:windAngleMax"`
	WaveHeightMax string `json:"waveHeightMax" gorm:"column:waveHeightMax"`
	WavePeriodMax string `json:"wavePeriodMax" gorm:"column:wavePeriodMax"`
	WaveHeightYx  string `json:"waveHeightYx" gorm:"column:waveHeightYx"`
	WavePeriodYx  string `json:"wavePeriodYx" gorm:"column:wavePeriodYx"`
}

//    {
//      "id": "42",
//      "coastalName": "洞头区洞头岛段",
//      "prefecture": "温州",
//      "county": "洞头区",
//      "stdName": "洞头站",
//      "blueLevel": "350.0",
//      "yellowLevel": "370.0",
//      "orangeLevel": "390.0",
//      "redLevel": "410.0",
//      "base85": "-333.0",
//      "heightTide": "380.0",
//      "warnLevel": "2",
//      "fcstTime": "16日 03:38",
//      "lon": "121.154089",
//      "lat": "27.84372",
//      "colDate": "16日",
//      "colTime": "03:38",
//      "ptime": "2023-03-16",
//      "num": "1"
//    },

// 预警岸段的结构体
type ForecastCoastal struct {
	Id          int    `json:"id" gorm:"column:id"`
	CoastalName string `json:"coastalName" gorm:"column:coastalName"`
	Prefecture  string `json:"prefecture" gorm:"column:prefecture"`
	County      string `json:"county" gorm:"column:county"`
	StdName     string `json:"stdName" gorm:"column:stdName"`
	BlueLevel   string `json:"blueLevel" gorm:"column:blueLevel"`
	YellowLevel string `json:"yellowLevel" gorm:"column:yellowLevel"`
	OrangeLevel string `json:"orangeLevel" gorm:"column:orangeLevel"`
	RedLevel    string `json:"redLevel" gorm:"column:redLevel"`
	Base85      string `json:"base85" gorm:"column:base85"`
	HeightTide  string `json:"heightTide" gorm:"column:heightTide"`
	WarnLevel   string `json:"warnLevel" gorm:"column:warnLevel"`
	FcstTime    string `json:"fcstTime" gorm:"column:fcstTime"`
	Lon         string `json:"lon" gorm:"column:lon"`
	Lat         string `json:"lat" gorm:"column:lat"`
	ColDate     string `json:"colDate" gorm:"column:colDate"`
	ColTime     string `json:"colTime" gorm:"column:colTime"`
	Ptime       string `json:"ptime" gorm:"column:ptime"`
	Num         string `json:"num" gorm:"column:num"`
}
